Skip to content

Add ifversion#1254

Merged
flibitijibibo merged 1 commit intoTerryCavanagh:masterfrom
NyakoFox:ifversion
Nov 21, 2025
Merged

Add ifversion#1254
flibitijibibo merged 1 commit intoTerryCavanagh:masterfrom
NyakoFox:ifversion

Conversation

@NyakoFox
Copy link
Contributor

@NyakoFox NyakoFox commented Nov 17, 2025

Changes:

This command adds ifversion, as both a simplified and internal command.

The system works like so:

  • ifversion(2.6,script2) -> If you're on 2.6.0 or greater
  • ifversion(2.6.0,script2) -> Same as above
  • ifversion(2.6.3,script2) -> You're using 2.6.3 or greater
  • ifversion(2.5,script2) -> You're using 2.5 or greater
  • ifversion(2,script2) -> You're using 2.0.0 or greater (yep...)

ReleaseVersion.h has a few new defines to make this possible, being MAJOR_VERSION, MINOR_VERSION and PATCH_VERSION. With the help of a few macros, RELEASE_VERSION is now constructed using those.

There's been a long-running problem where people play levels which use new features, with older versions of the game. While this doesn't solve the problem for people playing in 2.2, or something, we can at least make a system now to lessen the issue for future versions. Ideally this'll be merged in for 2.5.

This PR was supposed to be paired with some XML tags, but my burnout hit hard and my free time is limited due to college. It'd require translation strings, rendering code, another complex level tag, etc. So, it's being left out for now; as I think ifversion is better than nothing.

Legal Stuff:

By submitting this pull request, I confirm that...

  • My changes may be used in a future commercial release of VVVVVV
  • I will be credited in a CONTRIBUTORS file and the "GitHub Friends"
    section of the credits for all of said releases, but will NOT be compensated
    for these changes unless there is a prior written agreement

@NyakoFox
Copy link
Contributor Author

Turns out my comment is incorrect -- it just never worked at all, rather than breaking in vs2026. I'll force push the comment away in a bit

Copy link
Contributor

@Daaaav Daaaav left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple minor things:

  • Maybe the short for the version parts should be unsigned short instead - just because signed integer overflow is technically UB and unsigned integer overflow isn't (and so people in the year 70374794 will have a little more breathing room :P)
  • The name is_valid is a little confusing, I'd probably name it something like is_ge, is_enough, version_is_met... I'd also place the declaration lower, closer to where it's used.

Other than that (and the VS2026 comment) lgtm!

This command adds `ifversion`, as both a simplified and internal
command.

The system works like so:

- `ifversion(2.6,script2)` -> If you're on 2.6.0 or greater
- `ifversion(2.6.0,script2)` -> Same as above
- `ifversion(2.6.3,script2)` -> You're using 2.6.3 or greater
- `ifversion(2.5,script2)` -> You're using 2.5 or greater
- `ifversion(2,script2)` -> You're using 2.0.0 or greater (yep...)

`ReleaseVersion.h` has a few new defines to make this possible, being
`MAJOR_VERSION`, `MINOR_VERSION` and `PATCH_VERSION`. With the help of
a few macros, `RELEASE_VERSION` is now constructed using those.
@NyakoFox
Copy link
Contributor Author

Fixed and force pushed.

Copy link
Contributor

@Daaaav Daaaav left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, lgtm! :)

@flibitijibibo flibitijibibo merged commit 9256100 into TerryCavanagh:master Nov 21, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants